package com.irdstudio.efp.nls.api.rest.queue;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.irdstudio.basic.framework.web.controller.AbstractController;
import com.irdstudio.efp.batch.service.facade.queue.QueueScheduleService;

/**
 * Controller：队列调度
 * 
 * @author huangwb
 * @since 2018年12月27日 下午5:45:06
 * @version 1.0
 */
@RestController
@RequestMapping("/queueSchedule")
public class QueueScheduleController extends AbstractController {
	private static Logger logger = LoggerFactory.getLogger(QueueScheduleController.class);
	@Autowired
	@Qualifier("queueScheduleService")
	private QueueScheduleService queueScheduleService;

	/**
	 * 待执行的队列调度
	 * 
	 * @author huangwb
	 * @since 2018年12月27日 下午5:48:20
	 * @version 1.0
	 */
	@PostMapping(value = "/doExecutorySchedule")
	@ResponseBody
	public String doExecutorySchedule(@RequestBody Object executorySchedule) {
		logger.info("doExecutorySchedule in ");
		queueScheduleService.doExecutorySchedule();
		return "SUCCESS";
	}

	/**
	 * 挂起的队列调度
	 * 
	 * @author huangwb
	 * @since 2018年12月27日 下午5:48:20
	 * @version 1.0
	 */
	@PostMapping(value = "/doHangSchedule")
	@ResponseBody
	public String doHangSchedule(@RequestBody Object executorySchedule) {
		logger.info("doHangSchedule in ");
		queueScheduleService.doHangSchedule();
		return "SUCCESS";
	}
}
